package models

import (
	"fs_oms/eventsocket"
	"strings"
)

func SyncData() bool {
	c, err := eventsocket.Dial("localhost:8021", "ClueCon")
	if err != nil {
		return false
	}

	c.Send("api reloadxml")

	c.Close()

	return true
}

func GetXmlStatusProfileInternalReg() string {
	c, err := eventsocket.Dial("localhost:8021", "ClueCon")
	if err != nil {
		return ""
	}

	evt, err := c.Send("api sofia xmlstatus profile internal reg")
	if err != nil {
		return ""
	}

	c.Close()

	str := strings.Replace(evt.Body, "ISO-8859-1", "UTF-8", -1)

	return str
}
